home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / Documentation / MPW Reference / Online Reference / Prog. Asst. Tools for MPW / MPTA_MPWAccess next >
Encoding:
Text File  |  1996-04-18  |  2.2 KB  |  62 lines  |  [TEXT/MPS ]

  1. # Macintosh Programmer’s Assistant
  2. # Copyright © 1986-1996 Apple Computer, Inc. All rights reserved.
  3. #
  4. # -- brain surgery provided by the MPW doctors, 1/12/95, 3/29/96
  5. #
  6. # ------------------------------- #
  7. # MPTA_MPWAccess
  8. # ------------------------------- #
  9. #
  10. # Put this file in the MPW Scripts folder.
  11. #
  12. # This MPW script allows you to access the Macintosh Programmer’s Assistant
  13. # Apple Event commands from the MPW shell. It depends upon the {MPTA_Location} and
  14. # {MPTA_AppName} variables being defined and the Info menu being added by the
  15. # UserStartup•MPTA script. It also depends upon the existence of the SendAE tool in
  16. # the MPW Tools folder.
  17. #
  18. # {1} = name of the Macintosh Programmer’s Assistant command to execute
  19. #
  20.  
  21. set thisMPTA_AECommand "{1}"
  22.  
  23. If ("{thisMPTA_AECommand}" != "LookupHomePage") 
  24.     unset thisSelectedTerm                                        # initialize
  25.     If "`Catenate "{Active}.§"`" == ""
  26.         set exit 0
  27.         find \[¬{wordset}]\Δ:Δ/[¬{wordset}]/  "{Active}"        # select the current word
  28.         if "{status}" ≠ 0
  29.             if `position -l "{Active}"` == 1                    # first word in file?
  30.                 find •:/[{wordset}]+/ "{Active}"                # yes, select it
  31.             else                                                # else must be word at end of file
  32.                 find \[¬{wordset}]\Δ:∞  "{Active}"                # select the current word
  33.             end
  34.         end
  35.     end
  36.     set thisSelectedTerm "`Catenate "{Active}.§"`"                # remember the current selection
  37. end
  38.  
  39. if ("{thisMPTA_AECommand}" == "GetTemplate") 
  40.     "{MPTA_Location}" -background
  41. else
  42.     "{MPTA_Location}"
  43. end
  44.  
  45. if "{thisMPTA_AECommand}" == "LookupMPW"
  46.     # note that the following line appends "MPW" to the term, in order to distinguish the
  47.     # MPW lookup from a toolbox lookup
  48.    (SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "{thisSelectedTerm}MPW") ≥ dev:null
  49. else if "{thisMPTA_AECommand}" == "Lookup"
  50.    SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "{thisSelectedTerm}" ≥ dev:null
  51. else if "{thisMPTA_AECommand}" == "LookupHomePage"
  52.     (SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "MPA_Home") ≥ dev:null
  53. else if "{thisMPTA_AECommand}" == "GetTemplate"
  54.     set exit 0
  55.     set tmpl "`(SendAE -e "DanRTMPL" -t "{MPTA_AppName}" -dot -----TEXT "{thisSelectedTerm}") ≥ dev:null`"
  56.     if "{tmpl}" != ""
  57.         echo "{tmpl}" >"{Active}".§
  58.     End
  59. else
  60.     Alert "Macintosh Programmer’s Assistant error: ∂n∂n   “unrecognized command”"
  61. end
  62.